<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8"/>
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,minimum-scale=1, user-scalable=no">
  <title>函数参数默认值</title>
  <script src="../js/axios.js"></script>
  <script>
    let baseURL = 'https://api-hmugo-web.itheima.net/api/public/v1'
    let fetch = function(url, { methods = 'GET' }) {
      let obj = null
      //1
      if (methods === 'GET') {//2
        axios.get(baseURL + url).then(function(res) {
          console.log(res)
          obj  = res
        })
      }
      //3
      return obj
    }
    fetch('/goods/search',{})
  </script>
</head>
<body>
<div id="app"><!-- todo --></div>
</body>
</html>
